<ul id="nav">
    <li>
        <a href="{% url shop.views.product.list %}">Products ▼</a>
        <ul>
        {% for category in categories %}
            <li {% if forloop.last %}class="last-nav-item"{% endif %}><a href="{% url shop.views.product.list category_id=category.id %}">{{ category.name }}</a></li>
        {% endfor %}
        </ul>
    </li>
    <li><a href="{% url shop.views.cart.show %}">Cart <span id="cart-contents">{% if request.cart|length %}({{ request.cart|length }}){% endif %}</span></a></li>
    {% if user.is_authenticated %}
        <li>
            <a href="#">
                {% if user.first_name and user.last_name %}
                    {{ user.first_name }} {{ user.last_name }}
                {% else %}
                    {{ user.username }}
                {% endif %}
                ▼
            </a>
            <ul>
                {% if user.is_staff %}
                    <li><a href="{% url admin:index %}">Admin Panel</a></li>
                {% endif %}
                <li><a href="{% url shop.views.auth.account %}">Account</a></li>
                <li><a href="{% url shop.views.orders.show_orders %}">Orders</a></li>
                <li class="last-nav-item"><a href="{% url shop.views.auth.logout %}">Log out</a></li>
            </ul>
        </li>
    {% else %}
        <li><a href="{% url shop.views.auth.login %}">Log in</a></li>
    {% endif %}
</ul>
